
package Cart;

import DTO.Item;

/**
 *
 * @author Spence
 */
public class ItemInCart {
    
    private Item item;
    private int quantity;

    /**
     *
     */
    public ItemInCart(){

    }

    /**
     * parameterized constructor
     * @param item
     * @param quantity
     */
    public ItemInCart(Item item, int quantity){
        this.item = item;
        this.quantity = quantity;
    }

    /**
     * gets item from cart
     * @return
     */
    public Item getItem() {
        return item;
    }

    /**
     * gets quantity of items in cart
     * @return
     */
    public int getQuantity() {
        return quantity;
    }

    /**
     * sets an item in cart
     * @param item
     */
    public void setItem(Item item) {
        this.item = item;
    }

    /**
     * sets quantity of items in cart
     * @param quantity
     */
    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }

    /**
     * decrements the quantity of items in cart
     */
    protected void decreaseQty(){
        if (quantity>1)
            quantity--;
    }

    /**
     * increments the quantity of items in cart
     */
    protected void increaseQty(){
        quantity++;
    }
}
